# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-google-auth-httplib2
pkgver=0.1.1
pkgrel=1
pkgdesc="Google Authentication Library: httplib2 transport"
url="https://github.com/googleapis/google-auth-library-python-httplib2"
license=('Apache')
arch=('any')
depends=('python-google-auth' 'python-httplib2')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest' 'python-flask' 'python-pytest-localserver')
source=("https://pypi.io/packages/source/g/google-auth-httplib2/google-auth-httplib2-$pkgver.tar.gz")
sha512sums=('adcda6f61a6d4c40e8b3215dd4c1b88d9bac33c6a748201f0ea2f068b34a173526782e42fd8aea46628acd2b40941685e9dcf88d07dba498fde110801e65cb8d')

prepare() {
  cd google-auth-httplib2-$pkgver
  sed -i 's/import mock/from unittest import mock/' tests/test_google_auth_httplib2.py
}

build() {
  cd google-auth-httplib2-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd google-auth-httplib2-$pkgver
  pytest
}

package() {
  cd google-auth-httplib2-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
